package com.jsrana.idea.plugin.ideaweather.util;

import com.intellij.util.ui.UIUtil;

import java.awt.*;
import java.awt.image.BufferedImage;

/**
 * Created by jrana on 7/16/14.
 */
public class ImageUtil {
    public static BufferedImage resize(BufferedImage image, int width, int height) {
        BufferedImage bi = UIUtil.createImage( width, height, BufferedImage.TRANSLUCENT );
        Graphics2D g2d = (Graphics2D) bi.createGraphics();
        g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
        g2d.drawImage(image, 0, 0, width, height, null);
        g2d.dispose();
        return bi;
    }
}
